<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex align-stretch benben-position-layout flex signinPage_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex align-center justify-between flex-sub signinPage_fd0_0'>
          <view class='flex align-center signinPage_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
            <text class='fu-iconfont2  signinPage_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex align-center'>
            <text class='signinPage_fd0_0_c1_c0'>我的签到</text>
          </view>
          <view class='flex align-center justify-end signinPage_fd0_0_c0' @tap.stop="popupShow1673862116532=true">
            <text class='signinPage_fd0_0_c2_c0'>签到规则</text>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <benben-popup v-model="popupShow1673862116532" :mask="true" :mask-close-able="true" mode='center'>
        <!---富文本弹窗flex布局开始-->
        <view class="flex flex-direction flex-wrap align-center benben-flex-layout">
          <view class='flex flex-direction flex-wrap align-center signinPage_fd1_0'>
            <text class='signinPage_fd1_0_c0'>签到规则</text>

            <scroll-view class='signinPage_fd1_0_c1' :scroll-y='true'>
              <view class='flex benben-scroll flex align-center'>
                <jyf-parser class='signinPage_fd1_0_c1_c0' :html="dataMessage.content | richTextFormat">
                </jyf-parser>
              </view>
            </scroll-view>

          </view>
          <image class='signinPage_fd1_1' mode="aspectFit" :src='STATIC_URL+"313.png"'
            @tap.stop="popupShow1673862116532=false"></image>
        </view>

        <!---富文本弹窗flex布局结束-->

      </benben-popup>
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction align-center benben-flex-layout signinPage_flex_2">
        <view class='flex flex-wrap align-center signinPage_fd2_0'>
          <text>已累计签到</text>
          <text>{{calendar.sign_total}}</text>
          <text>天</text>
        </view>
        <view class='flex flex-wrap align-center signinPage_fd2_1'>
          <text>共获得</text>
          <text>{{calendar.score}}</text>
          <text>积分</text>
        </view>

        <benben-sign-card ref="benbenSignCardfd2_2" class='signinPage_fd2_2' :sign-data="calendar.data"
          :current-month.sync="month" key-name="create_time" @change="getcalendarFunc()">
          <template #head="{currentDate}">
            <view class='flex flex-wrap align-center self-center justify-center signinPage_fd2_2_c0'>
              <text class='fu-iconfont2  signinPage_fd2_2_c0_c0'
                @tap.stop="$refs.benbenSignCardfd2_2.onSwitchPrevMonth()">&#xe8ef;</text>
              <text>{{currentDate}}</text>
              <text class='fu-iconfont2  signinPage_fd2_2_c0_c0'
                @tap.stop="$refs.benbenSignCardfd2_2.onSwitchNextMonth()">&#xe8f0;</text>
            </view>
          </template></benben-sign-card>

        <button class='signinPage_fd2_3' @tap.stop="signImmediatelyFunc()"
          v-if=" calendar.today!='1'">立即签到</button><button class='signinPage_fd2_3_1'
          v-if=" calendar.today=='1'">已签到</button>
      </view>

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},


    data() {
      return {
        "popupShow1673862116532": false,
        "dataMessage": {
          "aid": "",
          "name": "",
          "thumb_img": "",
          "content": "",
          "introduce": ""
        },
        "calendar": {
          "user_id": "",
          "days": "",
          "create_time": "",
          "today": "",
          "score": "",
          "sign_total": "",
          "week_sign_info": [],
          "total": "",
          "per_page": "",
          "current_page": "",
          "last_page": "",
          "data": []
        },
        "month": ""
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.getMessageFunc()
      this.getcalendarFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //获取签到规则
      async getMessageFunc() {
        //请求方法
        //数据验证

        let datadataMessage = await this.$api.get(global.apiUrls.post641568f1b6f87, {
          column_id: '13'
        });

        if (datadataMessage.data.code != 1) {
          this.$message.info(datadataMessage.data.msg);
          return
        }
        let infodataMessage = datadataMessage.data;
        this.dataMessage = infodataMessage.data

      },
      //获取签到数据
      async getcalendarFunc() {
        //请求方法
        //数据验证

        let datacalendar = await this.$api.post(global.apiUrls.post64192099543cf, {
          start_time: this.month
        });

        if (datacalendar.data.code != 1) {
          this.$message.info(datacalendar.data.msg);
          return
        }
        let infocalendar = datacalendar.data;
        this.calendar = infocalendar.data

      },
      //立即签到
      async signImmediatelyFunc() {
        //请求方法
        //数据验证

        let data6419244390830 = await this.$api.post(global.apiUrls.post6419244390830, {
          type: '2'
        });

        if (data6419244390830.data.code != 1) {
          this.$message.info(data6419244390830.data.msg);
          return
        }



        this.$message.info('签到成功');
        this.getcalendarFunc()
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: url(image-path('364.png')) no-repeat;
    background-size: 100% auto;
  }

  .signinPage_flex_0 {
    background: url(image-path('364.png')) no-repeat, transparent;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .signinPage_fd0_0_c2_c0 {
    color: var(--benbenFontColor3);
  }

  .signinPage_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: var(--benbenFontColor3);
  }

  .signinPage_fd0_0_c0_c0 {
    font-size: 32rpx;
    font-weight: 500;
    color: var(--benbenFontColor3);
  }

  .signinPage_fd0_0_c0 {
    width: 180rpx;
  }

  .signinPage_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
    line-height: 88rpx;
  }

  .signinPage_fd1_1 {
    width: 56rpx;
    height: 56rpx;
    border-radius: 28rpx 28rpx 28rpx 28rpx;
  }

  ::v-deep .signinPage_fd1_0_c1_c0 {
    width: 480rpx;
  }

  .signinPage_fd1_0_c1 {
    touch-action: none;
    height: 330rpx;
    width: 480rpx;
  }

  .signinPage_fd1_0_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: rgba(51, 51, 51, 1);
    margin: 200rpx 0rpx 32rpx 0rpx;
  }

  .signinPage_fd1_0 {
    background: url(image-path('365.png')) no-repeat, #fff;
    width: 560rpx;
    background-size: 100% auto !important;
    border-radius: 24rpx 24rpx 24rpx 24rpx;
    padding: 28rpx 32rpx 45rpx 32rpx;
    margin: 0rpx 0rpx 40rpx 0rpx;
  }

  .signinPage_flex_2 {
    padding: 50rpx 0rpx 0rpx 0rpx;
  }

  .signinPage_fd2_3_1 {
    background: var(--benbenbgColor3);
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    width: 588rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
    margin: 40rpx 0rpx 40rpx 0rpx;
  }

  .signinPage_fd2_3 {
    background: var(--benbenbgColor7);
    border-radius: 44rpx 44rpx 44rpx 44rpx;
    width: 588rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
    margin: 50rpx 0rpx 40rpx 0rpx;
  }

  .signinPage_fd2_2_c0_c0 {
    padding: 0rpx 15rpx 0rpx 15rpx;
  }

  .signinPage_fd2_2_c0 {
    background: var(--benbenbgColor7);
    height: 80rpx;
    background-size: 100% auto !important;
    width: 400rpx;
    margin: 0rpx auto 32rpx auto;
    border-radius: 44rpx;
    color: var(--benbenFontColor3);
  }

  .signinPage_fd2_2 {
    background: var(--benbenbgColor1);
    border-radius: 24rpx 24rpx 24rpx 24rpx;
    margin: 0rpx 32rpx 0rpx 32rpx;
    padding: 32rpx 0rpx 0rpx 0rpx;
  }

  .signinPage_fd2_1 {
    margin: 48rpx 0rpx 300rpx 0rpx;
    font-size: 32rpx;
    font-weight: 700;
    color: var(--benbenFontColor3);
    line-height: 50rpx;
  }

  .signinPage_fd2_0 {
    font-size: 40rpx;
    font-weight: 700;
    color: var(--benbenFontColor3);
    line-height: 60rpx;
  }
</style>